
/********************************************************************************
  * @file     SD93F115B_op.h   						    	
  * @author   TEST TEAM 												    	
  * @version  v0															    	
  * @date     Septemper 2022												    	
  * @brief
  *
  * Copyright (C) 2022  Hangzhou SDIC Microelectronics Co., Ltd
*********************************************************************************/

#ifndef __SD93F115B_OP_H
#define __SD93F115B_OP_H

#ifdef __cplusplus
 extern "C" {
#endif

/* Includes ------------------------------------------------------------------*/
#include "SD93F115B.h"

/***************** 集成运放配置*********************/
typedef enum
{
	OPPS_A3 = 0x00,	     
    OPPS_A5 = 0x01,	
    OPPS_DAO = 0x02,
    OPPS_VBG = 0x03	
  
}OPPS_TypeDef;
#define IS_OPPS_Channel(Channel) (((Channel)==OPPS_A3)||((Channel)==OPPS_A5)||\
									  ((Channel)==OPPS_DAO)||((Channel)==OPPS_VBG))
typedef enum
{
	OPBNS_P17 = 0x00,	 
    OPBNS_A4 = 0x01,	
    OPNS_A2 = 0x02,
    OPNS_A6 = 0x03,
	OPANS_A7= 0x00,                             //OPA时:00为A7,01为A8    
	OPANS_A8=  0x01
	
}OPNS_TypeDef;

#define IS_OPNS_Channel(Channel) (((Channel)==OPBNS_P17)|| ((Channel)==OPBNS_A4)||\
									  ((Channel)==OPNS_A2)|| ((Channel)==OPNS_A6)||\
									  ((Channel)==OPANS_A7)|| ((Channel)==OPANS_A8))
typedef enum
{
	OPAOUT_A5=  0x40,                                
	OPAOUT_A6=  0x80,
	OPAOUT_A7=  0x100,                                
	OPAOUT_A8=  0x200
	
}OPAOUT_TypeDef;

#define IS_OPAOUT_Channel(Channel) (((Channel)==OPAOUT_A5)|| ((Channel)==OPAOUT_A6)||\
									((Channel)==OPAOUT_A7)|| ((Channel)==OPAOUT_A8))
								
									
#define OPA				         ((uint8_t)0x00)		     
#define OPB           	         ((uint8_t)0x01)
#define OPAOUTA5			     OP_CR_OPAOUTS0
#define OPAOUTA6			     OP_CR_OPAOUTS1
#define OPAOUTA7			     OP_CR_OPAOUTS2
#define OPAOUTA8			     OP_CR_OPAOUTS3
#define OPCSP			         OP_CR_OPACS                      
#define OPCSN			         ((uint32_t)0x00000000)
	
#define IS_OP_OPCS(OPCS) (((OPCS)==OPCSP)||((OPCS)==OPCSN))
									
typedef struct
{
	OPNS_TypeDef OPPS;        					  //选择OP正端输入通道	
    OPNS_TypeDef OPNS;                            //选择OP负端输入通道	
	uint32_t OPCSx;                               //OP相位选择
	
}OP_InitTypeDef;


/**************************运放相关参数设置*****************************/
void OP_DeInit(void);                                                         //将SIN相关寄存器恢复成上电默认值

void OPInit(uint8_t OPx,OP_InitTypeDef* OP_InitStruct);                //初始化OP相关参数
void VGSWCmd(FunctionalState NewState);                               //A0拉低使能
void OPAOUTChannelConfig(uint32_t OPAOUTAx,FunctionalState NewState);  //配置OPA输出端与A7或A8相连

void OPACmd(FunctionalState NewState);                                     //使能OPA功能
void OPBCmd(FunctionalState NewState);                                     //使能OPB功能

#ifdef __cplusplus
}
#endif

#endif /* __SD93F115B_OP_H */

/**********************************END OF FILE*********************************/

